package com.ythook.mentor.repository;

import com.ythook.mentor.entity.MentorSkills;
import com.ythook.mentor.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface MentorSkillsRepository extends JpaRepository<MentorSkills,Long> {

    @Modifying
    @Query(value = "delete from MentorSkills m where m.mentorId=?1 and m.technologyId=?2")
    Integer deleteByTechId(Long mentorId, Long techId);

    @Modifying
    @Query(value = "delete from MentorSkills m where m.mentorId=?1")
    Integer deleteByMentorId(Long mentorId);

    @Query(value = "select m from MentorSkills m where m.mentorId=?1")
    List<MentorSkills> findAllByMentorId(Long mentorId);
}
